<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:aw="clr-namespace:Assergs.Windows"
	xmlns:awc="clr-namespace:Assergs.Windows.Controls"
	>
    
	<Style x:Key="ButtonFocusVisualStyle">
		<Setter Property="Control.Template">
			<Setter.Value>
				<ControlTemplate>
					<Border
						CornerRadius="2.5"
						BorderBrush="#F6CF57"
						BorderThickness="2"	/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
    
	<SolidColorBrush x:Key="ForegroundColorBrush" Color="{x:Static aw:ImageButtonDefaultStylePallet.ForegroundColor}"/>
	<SolidColorBrush x:Key="NormalBorderBrush" Color="{x:Static aw:ImageButtonDefaultStylePallet.NormalBorder}"></SolidColorBrush>
	<SolidColorBrush x:Key="LightBorderBrush" Color="{x:Static aw:ImageButtonDefaultStylePallet.LightBorder}"/>
	<SolidColorBrush x:Key="PlusLightBorderBrush" Color="{x:Static aw:ImageButtonDefaultStylePallet.PlusLightBorder}"/>
	<SolidColorBrush x:Key="DisabledBorderBrush" Color="{x:Static aw:ImageButtonDefaultStylePallet.DisabledBorder}"/>
	<SolidColorBrush x:Key="DisabledForegroundBrush" Color="{x:Static aw:ImageButtonDefaultStylePallet.DisabledForeground}"/>
    
	<LinearGradientBrush x:Key="NormalBackGroundBrush" StartPoint="0.5,0" EndPoint="0.5,1">
		<GradientStop Color="{x:Static aw:ImageButtonDefaultStylePallet.NormalBackGround1}" Offset="0"/>
		<GradientStop Color="{x:Static aw:ImageButtonDefaultStylePallet.NormalBackGround2}" Offset="0.4"/>
		<GradientStop Color="{x:Static aw:ImageButtonDefaultStylePallet.NormalBackGround3}" Offset="0.4"/>
		<GradientStop Color="{x:Static aw:ImageButtonDefaultStylePallet.NormalBackGround4}" Offset="1"/>
	</LinearGradientBrush>

	<LinearGradientBrush x:Key="LightBackGroundBrush" StartPoint="0.5,0" EndPoint="0.5,1">
		<GradientStop Offset="0" Color="{x:Static aw:ImageButtonDefaultStylePallet.DefaultControlMouseOver1}" />
		<GradientStop Offset="0.4" Color="{x:Static aw:ImageButtonDefaultStylePallet.DefaultControlMouseOver2}" />
		<GradientStop Offset="0.4" Color="{x:Static aw:ImageButtonDefaultStylePallet.DefaultControlMouseOver3}" />
		<GradientStop Offset="1" Color="{x:Static aw:ImageButtonDefaultStylePallet.DefaultControlMouseOver4}" />
	</LinearGradientBrush>

	<LinearGradientBrush x:Key="PlusLightBackGroundBrush" StartPoint="0.5,0" EndPoint="0.5,1">
		<GradientStop Offset="0" Color="{x:Static aw:ImageButtonDefaultStylePallet.DefaultControlPressed1}" />
		<GradientStop Offset="0.1" Color="{x:Static aw:ImageButtonDefaultStylePallet.DefaultControlPressed2}" />
		<GradientStop Offset="0.4" Color="{x:Static aw:ImageButtonDefaultStylePallet.DefaultControlPressed3}" />
		<GradientStop Offset="0.4" Color="{x:Static aw:ImageButtonDefaultStylePallet.DefaultControlPressed4}" />
		<GradientStop Offset="1" Color="{x:Static aw:ImageButtonDefaultStylePallet.DefaultControlPressed5}" />
	</LinearGradientBrush>

	<LinearGradientBrush x:Key="DisableBackGroundBrush" StartPoint="0,0" EndPoint="0,1">
		<GradientStop Color="{x:Static aw:ImageButtonDefaultStylePallet.DisableBackGround1}"></GradientStop>
		<GradientStop Color="{x:Static aw:ImageButtonDefaultStylePallet.DisableBackGround2}"></GradientStop>
	</LinearGradientBrush>

	<Style TargetType="awc:ImageButton" >
		<Setter Property="Orientation" Value="Horizontal" />
		<Setter Property="Padding" Value="0" />
		<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisualStyle}" />
		<Setter Property="Template">
			<Setter.Value>

				<ControlTemplate TargetType="awc:ImageButton"> 

					<Border x:Name="masterBorder" SnapsToDevicePixels="True"
						BorderThickness="1" 
						Background="{StaticResource NormalBackGroundBrush}" 
						BorderBrush="{StaticResource NormalBorderBrush}" 
						CornerRadius="2">

						<DockPanel x:Name="dockPanel"
							HorizontalAlignment="{TemplateBinding ContentHorizontalAlignment}"
							VerticalAlignment="{TemplateBinding ContentVerticalAlignment}"
							Margin="{TemplateBinding Padding}"
							>

							<!--<TextBlock x:Name="textContent" DockPanel.Dock="Right" Margin="2"
							TextWrapping="Wrap" Text="{TemplateBinding Content}" TextAlignment="Center"/>-->

							<ContentPresenter  x:Name="_Content" DockPanel.Dock="Right" Margin="2"
								HorizontalAlignment="Center" VerticalAlignment="Center"/>

							<Image x:Name="image" Margin="2" Source="{TemplateBinding ImageSource}" Stretch="None" />

						</DockPanel>

					</Border>

					<ControlTemplate.Triggers>

						<Trigger Property="ImageSource" Value="{x:Null}">
							<Setter TargetName="_Content" Property="Margin" Value="0,2,0,2"/>
						</Trigger>

						<Trigger Property="IsEnabled" Value="False">
							<Setter TargetName="masterBorder" Property="Background" Value="{StaticResource DisableBackGroundBrush}" />
							<Setter TargetName="masterBorder" Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}" />
							<Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
							<Setter TargetName="image" Property="Opacity" Value="0.4"/>
						</Trigger>

						<Trigger Property="IsToolStyle" Value="True">
							<Setter TargetName="masterBorder" Property="Background" Value="Transparent" />
							<Setter TargetName="masterBorder" Property="BorderBrush" Value="{x:Null}"/>
						</Trigger>

						<Trigger Property="IsMouseOver" Value="True">
							<Setter TargetName="masterBorder" Property="Background" Value="{StaticResource LightBackGroundBrush}" />
							<Setter TargetName="masterBorder" Property="BorderBrush" Value="{StaticResource LightBorderBrush}" />
						</Trigger>

						<Trigger Property="IsPressed" Value="True">
							<Setter TargetName="masterBorder" Property="Background" Value="{StaticResource PlusLightBackGroundBrush}" />
							<Setter TargetName="masterBorder" Property="BorderBrush" Value="{StaticResource PlusLightBorderBrush}"/>
						</Trigger>

						<Trigger Property="Orientation" Value="Vertical">
							<Setter TargetName="_Content" Property="DockPanel.Dock" Value="Bottom" />
							<!--<Setter Property="MaxWidth" Value="60" />-->
							<Setter TargetName="image" Property="Margin" Value="2,2,2,1" />
							<Setter TargetName="_Content" Property="Margin" Value="2,1,2,2" />
						</Trigger>

						<!--<Trigger SourceName="textContent" Property="Text" Value="">-->
						<Trigger SourceName="_Content" Property="Content" Value="{x:Null}">
							<Setter TargetName="_Content" Property="Width" Value="0" />
							<Setter TargetName="_Content" Property="Height" Value="0" />
							<Setter TargetName="_Content" Property="Margin" Value="0" />
							<Setter TargetName="dockPanel" Property="HorizontalAlignment" Value="Center" />
							<Setter TargetName="dockPanel" Property="VerticalAlignment" Value="Center" />
						</Trigger>

					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>

	</Style>

</ResourceDictionary>